#include <stdio.h>
#include <math.h>
float a[5] = {2.33, 2.56, 2.65, 2.66, 2.30};
float t(float x,int n)
{	    	 
    float x1, x2;
    int i;
    for (x1 = x, i = 0; i < n - 1; i++)
        x1 *= 10.0;
    x2 = floor((double)x1);
    x1 = floor((double)(x1 - x2) * 10);
    if (x1 >= 5)
        x2 += 1;
    for (i = 0; i < n - 1; i++)
        x2 /= 10.0;
    return x2;
}	    	 
main()
{	    	 
    int i;
    printf("Old array:\n");
    for (i = 0; i < 5; i++)
        printf("a[%d]=%.3f\t", i, a[i]);
    printf("\nnew array:\n");
    for (i = 0; i < 5; i++)
        printf("a[%d]=%.2f\t", i, t(a[i], 2));
}	   